<?php echo $html->script(array("fckeditor.js","jquery.tablednd.js","jquery.validate.js")); ?>
<div class="breadcrumb">
    <ul id="breadcrumb">
        <li><a href="<?php echo Configure::read('base_url');?>backstage" title="Home">
		<?php echo $this->Html->image("home.png", array("alt" => "Home",'class'=>'home','border'=>'0'));?>
		</a></li>
                <li><a href="<?php echo Configure::read('base_url');?>backstage/cmspages/" title="Home">
		Pages
		</a></li>
        <li>Add New Page</li>
    </ul>
</div>
<?php echo $this->element('admin/admin_leftmenu'); ?>
<div id="left">
    <?php echo $this->Session->flash(); ?>
	<br class="clear" />
    <div class="div_header"><?php __('Add New Page'); ?></div>
    <div class="div_content">
		<form accept-charset="utf-8" action="<?php echo Configure::read('base_url');?>backstage/cmspages/add" method="post" id="productmessage">
<table cellspacing="0" >
             <tbody>
                <tr>
                     <td colspan="2">
                        Page Title:
                     </td>
                 </tr>
                 <tr>
                     <td class="tddata" colspan="2">
                         <?php
                         //echo $this->Form->input('id');
                         echo $this->Form->input('Cmspage.title',array('div'=>false,'label'=>false,'type'=>'text','size'=>45,'class'=>'required'));
                         ?>
                     </td>

                 </tr>
                 <tr>
                     <td colspan="2">
                        Page Listed Under:
                     </td>
                 </tr>
                 <tr>
                     <td class="tddata" colspan="2">
                       <?php
                         $options=array('About Us'=>'About Us','User Agreement'=>'User Agreement');
                          echo $this->Form->select('Cmspage.listed_under',$options,null,array('div'=>false,'label'=>false,'empty'=>'--Select--','class'=>'required'));
                         ?>
                     </td>

                 </tr>
                 <tr>
                     <td colspan="2">
                         Page Enabled:
                     </td>
                 </tr>
                 <tr>
                     <td class="tddata" colspan="2">
                            <?php
                         $options=array('Enabled'=>'Yes','Disable'=>'No');
                          echo $this->Form->select('Cmspage.status',$options,null,array('div'=>false,'label'=>false,'empty'=>false,'class'=>'required'));
                         ?>
                     </td>

                 </tr>
                 <tr>
                     <td colspan="2">
                        Page Content:
                     </td>
                 </tr>
                 <tr>
                     <td class="tddata" colspan="2">
                         <?php echo $form->textarea('Cmspage.content', array('cols' => '85', 'rows' => '15','class'=>'fckrequired'));?>
			<?php echo $fck->load('Cmspage.content', 'Custom');?>
                     </td>

                 </tr>
                 <tr>
                    <td colspan="2">
                    <input type="submit" style="background:#73AE0B; color:#fff; font-size:14px;" name="button" id="button" value="add" />
                    </td>
                  </tr>
                    </tbody>
                </table>
</form>

</div>
<div class="div_bottom"></div>
</div>
</div>
  
<script type="text/javascript">
    jQuery(document).ready(function(){

    jQuery.validator.addMethod("fckrequired", function (value, element) {
        var oEditor = FCKeditorAPI.GetInstance('CmspageContent') ;
        var pageValue = oEditor.GetHTML(true);
        pageValue=jQuery.trim(pageValue);
        if ( pageValue == "<br />" || pageValue == "") {
            return false;
        }else{
            return true;
        }
    }, "This field is required.");
    jQuery("#productmessage").validate();
});
</script>